package com.yanqu.road.server.timer.summerquiz;

import com.yanqu.road.server.manager.activity.summerquiz.CrossSummerQuizMgr;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;

public class CrossSummerQuizTask extends GeneralTask {

    private static long lastReloadConfigTime = System.currentTimeMillis();

    @Override
    public void doRun() {

        try{

            //半小时重载一次配置
            if(System.currentTimeMillis() - lastReloadConfigTime >= DateHelper.HOUR_MILLIONS / 2L){
                CrossSummerQuizMgr.reloadQuizConfig();
                lastReloadConfigTime = System.currentTimeMillis();
            }

        }catch(Exception e){
            getLOGGER().error("", e);
        }

        try{
            //计算赔率
            CrossSummerQuizMgr.calQuizOdds();
        }catch (Exception e){
            getLOGGER().error("", e);
        }

    }
}
